#include "systick_delay.h"

extern uint32_t SystemCoreClock;
static volatile uint32_t s_Timing;

void systick_init(void)
{
    // 1/180 us * 180
    //1us = 1,000,000
    //1ms = 1,000
    SysTick_Config(SystemCoreClock/1000000);
}

void delay_ms(uint32_t count)
{
    s_Timing = count * 1000;
    while(s_Timing != 0);
}

void delay_us(uint32_t count)
{
    s_Timing = count;
    while(s_Timing != 0);
}

void timingDecrease(void)
{
    if(s_Timing != 0)
        s_Timing--;
}
